var bu = document.getElementById("show");
var refurbish = document.getElementById("refurbish");
var x = document.getElementById("x");
var y = document.getElementById("y");
var z = document.getElementById("z");
x.onmouseover = hint;
y.onmouseover = hint;
z.onmouseover = hint;

async function buOnclic(){
    let dashC = '#9900FF';//虚线（辅助线）颜色
    if(x.value=='' || y.value=='' || z.value==''){
        alert('请先输入！');
		return;
    }
    let x1 = 0;
    let y1 = 0;
    let z1 = 0;
    try{
        x1 = eval(x.value);
        y1 = eval(y.value);
        z1 = eval(z.value);
    }catch(error){
        alert("输入格式不正确，请重新输入！");
		return;
    }
    
    var xy = toChange(x1,y1,z1);
    checkAxes(mycanvas,context,xy[0],xy[1],3);
    drowCube(context,x1,y1,z1);
    //开始绘制i,j,k
    context.save();
    context.lineWidth = 3;
    await drowDashedLine2(context, 0, 0, -x1, -x1, dashC);
    await drowDashedLine2(context, -x1, -x1, y1-x1, -x1, dashC);
    await drowDashedLine2(context, y1-x1, -x1, y1-x1, z1-x1, dashC);
    await drow3DVector(context,x1,y1,z1,false);
    
    addFont_3D(context,'a',x1,y1,z1,"black","bold italic 20pt Times new roman");
    context.restore();
}

drow3DAxes(context);
bu.addEventListener("click",buOnclic);
refurbish.onclick = function(){
	location.reload();
};